#include <ostream>
#include "MyLinkList.cpp"

class Person {
public:
    string name;
    int age;
    int score;

    Person(const string &name, int age, int score) : name(name), age(age), score(score) {}

};

void MyPrint(void* data) {
    Person* p = (Person*)data;
    cout<<p->name<<"\t"<<p->age<<"\t"<<p->score<<endl;
}

int main() {
    MyLinkList<Person> list;
    list = list.Init_LinkList();

    //创建数据
    Person p1("aaa",23,80);
    Person p2("bbb",24,81);
    Person p3("ccc",25,82);
    Person p4("ddd",26,83);
    Person p5("eee",27,84);

    //插入
    list.Insert_LinkList(1,&p1);
    list.Insert_LinkList(2,&p2);
    list.Insert_LinkList(3,&p3);
    list.Insert_LinkList(4,&p4);
    list.Insert_LinkList(5,&p5);

    //输出
    list.Print_LinkList(MyPrint);

    cout<<"================"<<endl;

    MyPrint(list.getElem(3).data);

    //销毁链表
    list.FreeSpace_LinkList();
    return 0;
}
